/*
 * @Author: zw
 * @Date: 2022-04-16 22:19:40
 * @LastEditors: Zhang Wei
 * @LastEditTime: 2022-04-17 21:49:57
 * @FilePath: \02_tank\src\main.ts
 * @Description:
 */
import StrawCanvas from './canvas/StrawCanvas';
import config from './config';
import './style.scss';

import { imgLoadList } from './service/image';
import WallCanvas from './canvas/WallCanvas';
import WaterCanvas from './canvas/WaterCanvas';
import SteelCanvas from './canvas/SteelCanvas';
import TankCanvas from './canvas/TankCanvas';

const app = document.querySelector<HTMLDivElement>('#app')!;

app.style.width = config.canvas.width + 'px';
app.style.height = config.canvas.height + 'px';

async function loadImg() {
  // 加载图片
  await Promise.all(imgLoadList);

  // 渲染画布
  StrawCanvas.render();
  WallCanvas.render();
  WaterCanvas.render();
  SteelCanvas.render();

  TankCanvas.render();
}

void loadImg();
